import { Injectable } from '@angular/core';
import {HttpClient} from '@angular/common/http'
import {of,Observable, ObservableLike, throwError} from 'rxjs'
import {catchError, retry} from 'rxjs/operators'
import {Hero} from '../model/user.model'

@Injectable({
  providedIn: 'root'
})
export class Service1Service {
  configUrl = 'assets/config.json'
  HEROES:Hero[] = [{id: 1, name: 'ldiuanjie'}]
  constructor(private http:HttpClient) { }
  getUsers():Hero[] {
    return this.HEROES
  }
  getuser1():Observable<Hero[]>{
    let hero = of(this.HEROES)
    return hero
  }
  getConfig(){
    return this.http.get<Hero[]>(this.configUrl)
  }
}
